﻿using System;
using System.Diagnostics;
using TI_BLE_HCI_ClientLib.HCIBaseEntities;
using TI_BLE_HCI_ClientLib.HCIEvents;
using Utilities;

namespace TI_BLE_HCI_ClientLib.HCIParsers
{
    public static partial class HCIEventParser
    {
        private static HCIEvent parseHCI_LE_ExtEvent_GAP_Advert_Data_Update_Done(byte parsLen, byte[] buffer)
        {
            if (parsLen != 4) throw new ArgumentException("parseHCI_LE_ExtEvent_GAP_AdvertDataUpdateDone Parameters Length != 4");
            byte bufIdx = 4;

            HCIVendorSpecificEventHostErrorCode status = (HCIVendorSpecificEventHostErrorCode)parseByteParameter(buffer, ref bufIdx);
            TI_BLE_HCI_ClientLib.HCIEvents.HCIEvent_GAP_Advert_Data_Update_Done.AdvertisingTypeEnum adType = (TI_BLE_HCI_ClientLib.HCIEvents.HCIEvent_GAP_Advert_Data_Update_Done.AdvertisingTypeEnum)parseByteParameter(buffer, ref bufIdx);

            var hciEvent = new HCIEvent_GAP_Advert_Data_Update_Done(status, adType);

            return hciEvent;
        }
    }
}
